/**
 * @param {number[]} nums
 * @return {number}
 */
var findRepeatNumber = function(nums) {
    let index = 0;
    while (index < nums.length) {
        if (nums[index] == index) {
            index++
            continue
        }
        if (nums[index] == nums[nums[index]]) {
            return nums[index]
        }
        [nums[nums[index]], nums[index]] = [nums[index], nums[nums[index]]];
    }
};

const arr = [2, 3, 1, 0, 2, 5, 3]
console.log(findRepeatNumber(arr))